load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "chunk",
    srcs = [
        "batcher.go",
        "cdr.go",
        "chunk.go",
        "chunk.pb.go",
        "chunk.pb.validate.go",
        "chunk.pb.zap.go",
        "chunker.go",
        "client.go",
        "gc.go",
        "metadata.go",
        "option.go",
        "reader.go",
        "renewer.go",
        "storage.go",
        "transform.go",
        "uploader.go",
        "util.go",
    ],
    importpath = "github.com/pachyderm/pachyderm/v2/src/internal/storage/chunk",
    visibility = ["//src:__subpackages__"],
    deps = [
        "//src/cdr",
        "//src/internal/backoff",
        "//src/internal/dbutil",
        "//src/internal/errors",
        "//src/internal/errutil",
        "//src/internal/log",
        "//src/internal/meters",
        "//src/internal/miscutil",
        "//src/internal/pacherr",
        "//src/internal/pachhash",
        "//src/internal/pachsql",
        "//src/internal/pctx",
        "//src/internal/require",
        "//src/internal/storage/kv",
        "//src/internal/storage/renew",
        "//src/internal/storage/track",
        "//src/internal/stream",
        "//src/internal/taskchain",
        "//src/pfs",
        "//src/protoextensions",
        "@com_github_chmduquesne_rollinghash//buzhash64",
        "@com_github_docker_go_units//:go-units",
        "@com_github_hashicorp_golang_lru_v2//:golang-lru",
        "@dev_gocloud//blob",
        "@org_golang_google_protobuf//proto",
        "@org_golang_google_protobuf//reflect/protoreflect",
        "@org_golang_google_protobuf//runtime/protoimpl",
        "@org_golang_google_protobuf//types/known/anypb",
        "@org_golang_x_crypto//chacha20",
        "@org_golang_x_sync//errgroup",
        "@org_golang_x_sync//semaphore",
        "@org_uber_go_zap//:zap",
        "@org_uber_go_zap//zapcore",
    ],
)

go_test(
    name = "chunk_test",
    size = "small",
    srcs = [
        "chunk_test.go",
        "gc_test.go",
    ],
    embed = [":chunk"],
    deps = [
        "//src/internal/dockertestenv",
        "//src/internal/errors",
        "//src/internal/pachhash",
        "//src/internal/pctx",
        "//src/internal/randutil",
        "//src/internal/require",
        "//src/internal/storage/kv",
        "//src/internal/storage/renew",
        "//src/internal/storage/track",
        "//src/internal/stream",
        "@com_github_chmduquesne_rollinghash//buzhash64",
        "@com_github_docker_go_units//:go-units",
    ],
)

filegroup(
    name = "protos",
    srcs = glob(["*.proto"]),
    visibility = ["//src:__pkg__"],
)
